package br.com.sebrae.pr.sgp.services.impl;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;

import br.com.sebrae.pr.sgp.dao.ClienteDAO;
import br.com.sebrae.pr.sgp.entities.Cliente;
import br.com.sebrae.pr.sgp.services.ClienteServiceRemote;

import com.google.common.base.Preconditions;

@Stateless
@TransactionManagement(value = TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class ClienteServiceImpl implements ClienteServiceRemote {

	@EJB
	private ClienteDAO clienteDAO;

	// @EJB
	// private MailServiceRemote mailServiceRemote;

	public ClienteServiceImpl() {
	}

	@Override
	public List<Cliente> efetuarPesquisa(final Cliente cliente) {
		return clienteDAO.efetuarPesquisa(cliente);
	}

	@Override
	public Cliente pesquisarPorLogin(final String nmeLogin) {
		return clienteDAO.pesquisarPorLogin(nmeLogin);
	}

	@Override
	public Cliente salvarOuAtualizar(final Cliente cliente) {
		Preconditions.checkNotNull(cliente, "Usuario deve ser informado!");
		Preconditions.checkNotNull(cliente.getId(), "ID do usuario deve ser informado!");
		return clienteDAO.salvarOuAtualizar(cliente);
	}

	@Override
    public List<String> autoComplete(String texto) {
		return clienteDAO.autoComplete(texto);
    }

	@Override
    public List<Cliente> pesquisarAutocomplete(String input) {
		return null;
//		return clienteDAO.autoCompleteO)(input);
    }

	@Override
    public String getChoiceId(Cliente obj) {
	    // TODO Auto-generated method stub
	    return null;
    }

	@Override
    public String getText(Cliente obj) {
	    // TODO Auto-generated method stub
	    return null;
    }

	@Override
    public String getChoice(Cliente obj, String criteria) {
	    // TODO Auto-generated method stub
	    return null;
    }

	@Override
    public Cliente getById(String id) {
	    // TODO Auto-generated method stub
	    return null;
    }

	@Override
    public List<Cliente> autoCompleteObjeto(String texto) {
	    // TODO Auto-generated method stub
	    return null;
    }

}
